import 'package:thinking/config/_.dart';
import 'TagEntity.dart';
import 'UserEntity.dart';

class DynamicEntity {
  int? _code;
  DynamicResult? _data;
  String? _message;

  DynamicEntity({int? code, DynamicResult? data, String? message}) {
    this._code = code;
    this._data = data;
    this._message = message;
  }

  int? get code => _code;
  set setCode(int code) => _code = code;
  String? get message => _message;
  set setMessage(String message) => _message = message;
  DynamicResult? get data => _data;
  set getData(DynamicResult data) => _data = data;

  DynamicEntity.fromJson(Map<String, dynamic> json) {
    _code = json['code'];
    _data = json['data'] != null ? DynamicResult.fromJson(json['data']) : null;
    _message = json['message'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['code'] = this._code;
    data['message'] = this._message;
    data['data'] = this._data!.toJson();

    return data;
  }
}

class DynamicResult {
  List<UserData>? _recentVisitList;
  List<Tag>? _topicList;
  List<DynamicDataEntity>? _dynamicList;

  DynamicResult({
    List<UserData>? recentVisitList,
    List<Tag>? topicList,
    List<DynamicDataEntity>? dynamicList,
  }) {
    this._recentVisitList = recentVisitList;
    this._topicList = topicList;
    this._dynamicList = dynamicList;
  }

  List<UserData>? get recentVisitList => _recentVisitList;
  set setRecentVisitList(List<UserData> recentVisitList) =>
      _recentVisitList = recentVisitList;
  List<Tag>? get topicList => _topicList;
  set setTopicList(List<Tag> topicList) => _topicList = topicList;
  List<DynamicDataEntity>? get dynamicList => _dynamicList;
  set setDynamicList(List<DynamicDataEntity> dynamicList) =>
      _dynamicList = dynamicList;

  DynamicResult.fromJson(Map<String, dynamic> json) {
    _recentVisitList = [];
    if (json['recentVisit_List'] != null) {
      json['recentVisit_List'].forEach((v) {
        _recentVisitList!.add(UserData.fromJson(v));
      });
    }
    _topicList = [];
    if (json['topic_List'] != null) {
      json['topic_List'].forEach((v) {
        _topicList!.add(Tag.fromJson(v));
      });
    }
    _dynamicList = [];
    if (json['dynamic_List'] != null) {
      json['dynamic_List'].forEach((v) {
        _dynamicList!.add(DynamicDataEntity.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this._recentVisitList != null) {
      data['recentVisit_List'] =
          this._recentVisitList!.map((v) => v.toJson()).toList();
    }
    if (this._topicList != null) {
      data['topic_List'] = this._topicList!.map((v) => v.toJson()).toList();
    }
    if (this._dynamicList != null) {
      data['dynamic_List'] = this._dynamicList!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class DynamicDataEntity {
  int? _dynamicId;
  String? _dynamicImg;
  String? _dynamicTime;
  String? _dynamicIntroduce;
  UserData? _dynamicUser;
  DynamicInfoEntity? _dynamicInfoEntity;
  int? _dynamicShareCount;
  int? _dynamicCommentCount;
  int? _dynamicLikeCount;
  int? _dynamicCollectionCount;
  bool? _dynamicIsLike;
  bool? _dynamicIsCollection;
  List<dynamic>? _dynamicTagList;

  DynamicDataEntity(
      {int? dynamicId,
      String? dynamicImg,
      String? dynamicTime,
      String? dynamicIntroduce,
      UserData? dynamicUser,
      DynamicInfoEntity? dynamicInfoEntity,
      int? dynamicShareCount,
      int? dynamicCommentCount,
      int? dynamicLikeCount,
      int? dynamicCollectionCount,
      bool? dynamicIsLike,
      bool? dynamicIsCollection,
      List<dynamic>? dynamicTagList}) {
    this._dynamicId = dynamicId;
    this._dynamicImg = dynamicImg;
    this._dynamicTime = dynamicTime;
    this._dynamicIntroduce = dynamicIntroduce;
    this._dynamicUser = dynamicUser;
    this._dynamicInfoEntity = dynamicInfoEntity;
    this._dynamicShareCount = dynamicShareCount;
    this._dynamicCommentCount = dynamicCommentCount;
    this._dynamicLikeCount = dynamicLikeCount;
    this._dynamicCollectionCount = dynamicCollectionCount;
    this._dynamicIsLike = dynamicIsLike;
    this._dynamicIsCollection = dynamicIsCollection;
    this._dynamicTagList = dynamicTagList;
  }

  int? get dynamicId => _dynamicId;
  set setDynamicId(int dynamicId) => _dynamicId = dynamicId;
  String? get dynamicImg => _dynamicImg;
  set setDynamicImg(String dynamicImg) => _dynamicImg = dynamicImg;
  String? get dynamicTime => _dynamicTime;
  set setDynamicTime(String dynamicTime) => _dynamicTime = dynamicTime;
  String? get dynamicIntroduce => _dynamicIntroduce;
  set setDynamicIntroduce(String dynamicIntroduce) =>
      _dynamicIntroduce = dynamicIntroduce;
  UserData? get dynamicUser => _dynamicUser;
  set setDynamicUser(UserData dynamicUser) => _dynamicUser = dynamicUser;
  int? get dynamicShareCount => _dynamicShareCount;
  set setDynamicShareCount(int dynamicShareCount) =>
      _dynamicShareCount = dynamicShareCount;
  int? get dynamicCommentCount => _dynamicCommentCount;
  set setDynamicCommentCount(int dynamicCommentCount) =>
      _dynamicCommentCount = dynamicCommentCount;
  int? get dynamicCollectionCount => _dynamicCollectionCount;
  set setDynamicCollectionCount(int dynamicCollectionCount) =>
      _dynamicCollectionCount = dynamicCollectionCount;
  int? get dynamicLikeCount => _dynamicLikeCount;
  set setDynamicLikeCount(int dynamicLikeCount) =>
      _dynamicLikeCount = dynamicLikeCount;
  DynamicInfoEntity? get dynamicInfoEntity => _dynamicInfoEntity;
  set setDynamicInfoEntity(DynamicInfoEntity dynamicInfoEntity) =>
      _dynamicInfoEntity = dynamicInfoEntity;
  bool? get dynamicIsLike => _dynamicIsLike;
  set setDynamicIsLike(bool dynamicIsLike) => _dynamicIsLike = dynamicIsLike;
  bool? get dynamicIsCollection => _dynamicIsCollection;
  set setDynamicIsCollection(bool dynamicIsCollection) =>
      _dynamicIsCollection = dynamicIsCollection;
  List<dynamic>? get dynamicTagList => _dynamicTagList;
  set setDynamicTagList(List<dynamic> dynamicTagList) =>
      _dynamicTagList = dynamicTagList;

  DynamicDataEntity.fromJson(Map<String, dynamic> json) {
    _dynamicId = json['dynamic_Id'];
    _dynamicImg = json['dynamic_Img'] != null
        ? Config.apiUrl['BasePhotoUrl'] + json['dynamic_Img']
        : null;
    _dynamicTime = json['dynamic_Time'];
    _dynamicIntroduce = json['dynamic_Introduce'];
    _dynamicUser = json['dynamic_User'] != null
        ? UserData.fromJson(json['dynamic_User'])
        : null;
    _dynamicInfoEntity = json['dynamic_Info'] != null
        ? DynamicInfoEntity.fromJson(json['dynamic_Info'])
        : null;
    _dynamicShareCount = json['dynamic_ShareCount'];
    _dynamicCommentCount = json['dynamic_CommentCount'];
    _dynamicLikeCount = json['dynamic_LikeCount'];
    _dynamicCollectionCount = json['dynamic_CollectionCount'];
    _dynamicIsLike = json['isLike'] != null ? json['isLike'] : false;
    _dynamicIsCollection =
        json['isCollection'] != null ? json['isCollection'] : false;
    _dynamicTagList =
        json['dynamic_TagList'] != null ? json['dynamic_TagList'] : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['dynamic_User'] =
        this._dynamicUser != null ? this._dynamicUser!.toJson() : null;
    data['dynamic_Id'] = this._dynamicId;
    data['dynamic_Img'] = this._dynamicImg;
    data['dynamic_Time'] = this._dynamicTime;
    data['dynamic_Introduce'] = this._dynamicIntroduce;
    data['dynamic_ShareCount'] = this._dynamicShareCount;
    data['dynamic_CommentCount'] = this._dynamicCommentCount;
    data['dynamic_LikeCount'] = this._dynamicLikeCount;
    data['dynamic_Info'] = this._dynamicInfoEntity;
    data['dynamic_CollectionCount'] = this._dynamicCollectionCount;
    data['isLike'] = this._dynamicIsLike;
    data['isCollection'] = this._dynamicIsCollection;
    data['dynamic_TagList'] = this._dynamicTagList;
    return data;
  }
}

class DynamicPageEntity {
  int _dynamicPage = 0;
  int _tagPage = 0;
  int _dynamicCount = 6;
  int _tagCount = 8;
  bool _canDynamic = true;
  bool _canTag = true;

  int get dynamicPage => _dynamicPage;
  set setDynamicPage(int dynamicPage) => _dynamicPage = dynamicPage;
  int get tagPage => _tagPage;
  set setTagPage(int tagPage) => _tagPage = tagPage;
  int get dynamicCount => _dynamicCount;
  set setDynamicCount(int dynamicCount) => _dynamicCount = dynamicCount;
  int get tagCount => _tagCount;
  set setTagCount(int tagCount) => _tagCount = tagCount;
  bool get canDynamic => _canDynamic;
  set setCanDynamic(bool canDynamic) => _canDynamic = canDynamic;
  bool get canTag => _canTag;
  set setCanTag(bool canTag) => _canTag = canTag;
}

class OnlyDynamicPageEntity {
  int _dynamicPage = 0;
  int _dynamicCount = 6;
  bool _canDynamic = true;

  int get dynamicPage => _dynamicPage;
  set setDynamicPage(int dynamicPage) => _dynamicPage = dynamicPage;
  int get dynamicCount => _dynamicCount;
  set setDynamicCount(int dynamicCount) => _dynamicCount = dynamicCount;
  bool get canDynamic => _canDynamic;
  set setCanDynamic(bool canDynamic) => _canDynamic = canDynamic;
}

class DynamicInfoEntity {
  int? _dynamicInfoId;
  List<dynamic>? _dynamicInfoImgList;
  int? get dynamicInfoId => _dynamicInfoId;
  set setDynamicPage(int dynamicInfoId) => _dynamicInfoId = dynamicInfoId;
  List<dynamic>? get dynamicInfoImgList => _dynamicInfoImgList;
  set setDynamicCount(List<dynamic> dynamicInfoImgList) =>
      _dynamicInfoImgList = dynamicInfoImgList;

  DynamicInfoEntity({int? dynamicInfoId, List<dynamic>? dynamicInfoImgList}) {
    this._dynamicInfoId = dynamicInfoId;
    this._dynamicInfoImgList = dynamicInfoImgList;
  }
  DynamicInfoEntity.fromJson(Map<String, dynamic> json) {
    _dynamicInfoId = json['dynamicInfo_Id'];
    _dynamicInfoImgList = json['dynamicInfo_ImgList'] != null
        ? json['dynamicInfo_ImgList']
        : null;
  }
  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['dynamicInfo_Id'] = _dynamicInfoId;
    data['dynamicInfo_ImgList'] = _dynamicInfoImgList;
    return data;
  }
}
